#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QInputDialog>
#include<QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    int res = QInputDialog::getInt(this, "对话框", "输入整数：");
    qDebug() <<res;
}

void MainWindow::on_pushButton_2_clicked()
{
    int res = QInputDialog::getDouble(this, "对话框", "浮点数：");
    qDebug() <<res;
}

void MainWindow::on_pushButton_3_clicked()
{
    QStringList items;
    items.push_back("111");
    items.push_back("112");
    items.push_back("113");
    items.push_back("114");
    QString res = QInputDialog::getItem(this, "对话框", "条目：", items);
    //第四个参数类型是const QStringList &items 可以把QStringList当成一个字符串数组
    //QList<QString> 类似于list和vector
    qDebug() <<res;
}
